﻿<%@ Page Language="C#" %>

<!DOCTYPE html>

<script runat="server">

</script>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <meta name="renderer" content="webkit" />
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1" />
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
    <script type="text/javascript" src="/Themes/Js/init.js"></script>
    <title>网站演示程序
    </title>
    <style type="text/css">
        .tree-node { line-height: 20px; height: 20px; padding: 6px 0 6px 0; }
        .tree-node .tree-title { font-size: 14px; font-family: 'Microsoft YaHei'; }
    </style>
</head>
<body class="easyui easyui-layout">
    <div region="north" data-options="region:'north',split:false,border:0" class="top">
        <table width="100%" cellpadding="0" cellspacing="0">
            <tr>
                <td class="title titleColor" id="webName" style="padding-left: 10px;"><%= ConfigurationManager.AppSettings["webName"].ToString() %></td>
                <td class="title">
                    <%-- <div>
                        <span id="OrgJs"></span><span id="login_name">您好:<span id="user_name"></span></span>
                    </div>--%>
                    <div>
                        您好:<span id="user_name"></span>&nbsp;&nbsp;&nbsp;<%--<a href="/main.aspx">桌面</a>|--%>
                        <a href="javascropt:void(0);" onclick="aa('个人信息', '/UserInfo/edit.aspx', '670px', '600px');">个人信息</a>|
                        <a href="javascropt:void(0);" onclick="aa('修改密码', '/UserInfo/UpdatePassWord.aspx', '550px', '300px');">修改密码</a>|
                        <a href="javascript:void(0);" onclick="LoginOut();">安全退出</a>
                    </div>
                </td>
            </tr>
        </table>
    </div>
    <div data-options="region:'west',split:true" title="导航" style="width: 200px; border-bottom: 0px; border-top: 0px;">
        <div class="easyui-accordion" data-options="fit:true,border:false" id="accordionID" style="line-height: 55px;">
        </div>
    </div>

    <div data-options="region:'center'" style="overflow: hidden; border-bottom: 0px;">
        <div id="tabs" class="easyui-tabs" data-options="fit:true,border:false" style="overflow: hidden;">
        </div>
    </div>
   <%-- <div id="CopyRight" data-options="region:'south',split:false,collapsed:false" style="text-align: center; height: 40px; line-height: 40px; overflow: hidden; background-color: #E0ECFF; font-size: 12px">
        版权说明 @2020-2022
    </div>--%>

    <div id="menu" class="easyui-menu" style="width: 150px; display: none;">
        <div id="refresh">刷新</div>
        <div class="menu-sep"></div>
        <div id="close">关闭</div>
        <div id="closeall">关闭全部标签</div>
        <div id="closeother">关闭其它标签</div>
        <div class="menu-sep"></div>
        <div id="closeleft">关闭左侧标签</div>
        <div id="closeright">关闭右侧标签</div>
        <div class="menu-sep"></div>
        <div id="exit">退出</div>
    </div>


    <script type="text/javascript">     
        function aa(title, url, w, h) {
            $.layerOpen({ title: title, width: w, height: h, url: url, });
        }


        var JurisdictionList = [];
        function LoginOut() {
            if ($.messager) {
                $.messager.defaults.ok = '确定';
                $.messager.defaults.cancel = '取消';
            }
            $.messager.confirm('提示', '确认要退出系统吗？', function (r) {
                if (r) {
                    clearCookie();
                    location.href = "/Login.html";
                }
            });
        }
        $(function () {
            if (Cookies.get('login_token') == null || Cookies.get('login_token') == "null" || Cookies.get('login_token') == undefined) {
                location.href = "/Login.html";
            }
            $.SetValue("user_name", Cookies.get("user_name"));
        });
    </script>


    <script type="text/javascript">

        $(function () {
            leftMenu();
            new MeunTree('tree', 'tabs', 'tree_menu', null, '桌面', "/desktop.aspx");
        });
        function leftMenu() {
            $.InvokeAjax({
                url: "system/GetMenusByJurisdiction",
                data: {},
                callBack: function (reslut) {
                    var data = reslut.Data;
                    var str = "";
                    var itemStr = [];
                    var cj = data[0].grade;
                    $.each(data, function (i, e) {
                        if (e.grade == data[0].grade) {

                            $('#accordionID').accordion('add', {
                                title: e.name.split('|')[0],
                                content: '<ul class="easyui-tree" id="' + e.ID + '"></ul>',
                                selected: i == 0 ? true : false
                            });

                            var _data = [];
                            $.each(data, function (k, item) {
                                if (item.PID == e.ID) {
                                    _data.push({ state: "open", text: item.name, id: item.id, attributes: { url: item.url } });
                                }
                            });

                            $("#" + e.ID).tree({
                                data: _data,
                                lines: false,
                                animate: true,
                                onClick: function (node) {
                                    var node = $("#" + e.ID).tree('getSelected');
                                    if (node.attributes.url != "" && node.attributes.url != "about:blank") {
                                        var title = node.text;
                                        var url = node.attributes.url;
                                        url = url.replace('$CompanyName$', Cookies.get('BodyName'));
                                        addIframe(title, url);
                                    }
                                    else {
                                        $.messager.alert('提示信息', '未配置连接地址！', 'info');
                                    }
                                }
                            });
                        }
                    });
                    $("#leftNav").html(itemStr.join(''));

                }
            });
        }

        function addIframe(title, url) {
            if ($("#tabs").tabs('exists', title)) {
                $("#tabs").tabs('select', title);
                var iframe = $("#tabs").tabs('getTab', title).find('iframe')[0];
                iframe.src = url;
            }
            else {
                var content = '<div style="overflow:hidden;width:100%;height:100%;"><iframe scrolling="auto" frameborder="0"  src="' + url + '" style="width:100%;height:100%;"></iframe></div>';
                $("#tabs").tabs('add', {
                    title: title,
                    content: content,
                    loadingMessage: '加载中...',
                    closable: true
                });
            }
        };

        /*清除缓存*/
        function clearCookie() {
            Cookies.get('login_token', null, { path: '/' });//删除 
            //Cookies.get('SystemCategory', null, { path: '/' });//删除 
            //Cookies.get('Jurisdiction', null, { path: '/' });//删除 
            //Cookies.get('userid', null, { path: '/' });//删除 
        }
    </script>
</body>
</html>
